package com.niubi.yygh.orders.receiver;

import com.niubi.yygh.orders.service.OrderInfoService;
import com.niubi.yygh.rabbit.constant.MqConst;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class OrderReceiver {
  @Autowired
  OrderInfoService orderInfoService;

  @RabbitListener(bindings = @QueueBinding(
          value = @Queue(value = MqConst.QUEUE_TASK_8, durable = "true"),
          exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_TASK),
          key = {MqConst.ROUTING_TASK_8}
  ))
  public void patientTips(String dateString, Message message,
                          Channel channel) throws IOException {
    orderInfoService.patientTips(dateString);
  }

}
